class Lady {
  content = 'Hi, Boy'
  say() {
    return this.content
  }
}

const goddess = new Lady()
console.log(goddess.say())

class Girl extends Lady{
  // 重写继承的类方法
  say() {
    // supper.say() 调用继承对象的方法
    return super.say() + '!!'
  }

  sayLove() {
    return 'love'
  }
}

const classTest = new Girl()
console.log(classTest.say())
console.log(classTest.sayLove())

class Person {
  private id: number = -1
  // 内部可用
  protected type: string = 'obj'
  // 默认为 public
  // public name: string = 'inner'
  constructor(public name?: string) {
    this.name = name
  }

  public say() {
    console.log('>>>', this.name)
  }
}

class Teacher extends Person {
  constructor() {
    super()
  }
  
  public bye() {
    // 继承时，可调用 protected
    console.log(this.type)
  }
}

const person = new Person()
person.name = 'abcd'
console.log(person.name)
person.say()
